﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Converters="clr-namespace:DDU.Converters;assembly=DDU.Converters"
    xmlns:local="clr-namespace:DDU.UX">

    <Converters:StringToPathGeometryConverter x:Key="StringToPathGeometryConverter"/>
    <Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    <Style TargetType="local:UXRadioButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXRadioButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Normal" />

                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="el"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="26"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Path VerticalAlignment="Center" Data="M0,0L53.333,0 53.333,8.888 0,8.888z" Stretch="Uniform" Fill="{TemplateBinding Foreground}" Width="26" Height="26" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" Name="el">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <TransformGroup.Children>
                                        <RotateTransform Angle="0" />
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </TransformGroup.Children>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                        <Path VerticalAlignment="Center" Data="F1M574.042,314.611L533.8,344.398 522.251,328.798 515.235,333.988 526.786,349.593 526.782,349.596 531.978,356.603 579.235,321.622 574.042,314.611z" Stretch="Uniform" Fill="{TemplateBinding Foreground}" Width="26" Height="26" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <RotateTransform Angle="0" />
                                    <ScaleTransform ScaleX="1" ScaleY="1" />
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                        <Grid Background="White" Opacity="0" Grid.ColumnSpan="2"/>
                        <ContentPresenter
                              Grid.Column="1"
                              x:Name="contentPresenter"
                              Content="{TemplateBinding Content}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                              Margin="{TemplateBinding Padding}"/>
                        <!--<TextBlock Style="{StaticResource PhoneTextTitle3Style}" Text="{TemplateBinding Content}" Grid.Column="1" Foreground="{TemplateBinding Foreground}"/>-->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXTextMenu">
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXTextMenu">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled"/>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="text"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" 
                                   Name="text"
                                   Opacity="1"
                                   Margin="12,6"
                                   Style="{StaticResource PhoneTextTitle2Style}" 
                                   Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXTextButton">
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXTextButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled"/>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="text"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" 
                                   Name="text"
                                   Opacity="1"
                                   Margin="12"
                                   Style="{StaticResource PhoneTextTitle3Style}" 
                                   Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXIconTextButton">
        <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXIconTextButton">
                    <Grid>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                        <DoubleAnimation Duration="0" To="0" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="disableGrid"/>

                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                        
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Background="White" Opacity="0"/>
                        
                        <Grid Name="normalGrid">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Path VerticalAlignment="Center" 
                                  Data="{Binding Path, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IconMargin}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Width="{TemplateBinding IconSize}"
                                  Height="{TemplateBinding IconSize}"
                                  Fill="{TemplateBinding Foreground}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>

                            <TextBlock  Text="{TemplateBinding Content}" Style="{StaticResource PhoneTextTitle3Style}" Grid.Column="1" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />

                        </Grid>
                        
                        <Grid Name="pressedGrid" Opacity="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Path VerticalAlignment="Center" 
                                  Data="{Binding Path, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IconMargin}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Width="{TemplateBinding IconSize}"
                                  Height="{TemplateBinding IconSize}"
                                  Fill="{StaticResource PhoneBackgroundBrush}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>

                            <TextBlock Foreground="{StaticResource PhoneBackgroundBrush}" 
                                       Text="{TemplateBinding Content}" Style="{StaticResource PhoneTextTitle3Style}" Grid.Column="1" VerticalAlignment="Center"/>
                        </Grid>

                        <Grid Name="disableGrid" Opacity="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Path VerticalAlignment="Center" 
                                  Data="{Binding Path, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IconMargin}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Width="{TemplateBinding IconSize}"
                                  Height="{TemplateBinding IconSize}"
                                  Fill="{StaticResource PhoneDisabledBrush}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>

                            <TextBlock  Text="{TemplateBinding Content}" 
                                        Style="{StaticResource PhoneTextTitle3Style}" 
                                        Grid.Column="1" VerticalAlignment="Center" 
                                        Foreground="{StaticResource PhoneDisabledBrush}" />

                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXIconTextButtonWithParam">
        <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXIconTextButtonWithParam">
                    <Grid>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                        <DoubleAnimation Duration="0" To="0" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="disableGrid"/>

                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>

                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Background="White" Opacity="0"/>

                        <Grid Name="normalGrid">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Path VerticalAlignment="Center" 
                                  Data="{Binding Path, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IconMargin}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Width="{TemplateBinding IconSize}"
                                  Height="{TemplateBinding IconSize}"
                                  Fill="{TemplateBinding Foreground}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>

                            <TextBlock  Text="{TemplateBinding Content}" Style="{StaticResource PhoneTextTitle3Style}" Grid.Column="1" VerticalAlignment="Center" Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />

                        </Grid>

                        <Grid Name="pressedGrid" Opacity="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Path VerticalAlignment="Center" 
                                  Data="{Binding Path, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IconMargin}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Width="{TemplateBinding IconSize}"
                                  Height="{TemplateBinding IconSize}"
                                  Fill="{StaticResource PhoneBackgroundBrush}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>

                            <TextBlock Foreground="{StaticResource PhoneBackgroundBrush}" 
                                       Text="{TemplateBinding Content}" Style="{StaticResource PhoneTextTitle3Style}" Grid.Column="1" VerticalAlignment="Center"/>
                        </Grid>

                        <Grid Name="disableGrid" Opacity="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Path VerticalAlignment="Center" 
                                  Data="{Binding Path, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IconMargin}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Width="{TemplateBinding IconSize}"
                                  Height="{TemplateBinding IconSize}"
                                  Fill="{StaticResource PhoneDisabledBrush}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>

                            <TextBlock  Text="{TemplateBinding Content}" 
                                        Style="{StaticResource PhoneTextTitle3Style}" 
                                        Grid.Column="1" VerticalAlignment="Center" 
                                        Foreground="{StaticResource PhoneDisabledBrush}" />

                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXPathButton">
        <Setter Property="Width" Value="48"/>
        <Setter Property="Height" Value="48"/>
        <Setter Property="Padding" Value="12"/>
        <Setter Property="BorderThickness" Value="3"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXPathButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Name="normalGrid" Opacity="1">
                            <Ellipse Stroke="{TemplateBinding Foreground}" 
                                     StrokeThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StrokeThickness}"/>
                            <Path VerticalAlignment="Center" 
                                  Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Name="el" Fill="{TemplateBinding Foreground}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="pressedGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="disableGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXPathButtonWithParam">
        <Setter Property="Width" Value="48"/>
        <Setter Property="Height" Value="48"/>
        <Setter Property="Padding" Value="12"/>
        <Setter Property="BorderThickness" Value="3"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXPathButtonWithParam">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Name="normalGrid" Opacity="1">
                            <Ellipse Stroke="{TemplateBinding Foreground}" 
                                     StrokeThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StrokeThickness}"/>
                            <Path VerticalAlignment="Center" 
                                  Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Name="el" Fill="{TemplateBinding Foreground}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="pressedGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="disableGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:UXCheckBox">
        <Setter Property="Width" Value="48"/>
        <Setter Property="Height" Value="48"/>
        <Setter Property="Padding" Value="12"/>
        <Setter Property="BorderThickness" Value="3"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:UXCheckBox">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".5" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="normalGrid"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         Storyboard.TargetName="pressedGrid"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Name="normalGrid" Opacity="1">
                            <Ellipse Stroke="{TemplateBinding Foreground}" 
                                     StrokeThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=StrokeThickness}"/>
                            <Path VerticalAlignment="Center" 
                                  Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" 
                                  RenderTransformOrigin="0.5,0.5" 
                                  Name="el" Fill="{TemplateBinding Foreground}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="pressedGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Grid Name="disableGrid" Opacity="0">
                            <Ellipse Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
                            <Path Data="{Binding IconPath, Converter={StaticResource StringToPathGeometryConverter}, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Stretch="Uniform" Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding}" RenderTransformOrigin="0.5,0.5" 
                                  Fill="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <RotateTransform Angle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}" />
                                            <ScaleTransform ScaleX="1" ScaleY="1" />
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>